package com.lp.learn.learnspringboot.redis;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

@Service
public class RedisService extends AbstractRedisService<String>{


    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    public boolean set(String key,String value){
        return this.set(stringRedisTemplate,key,value);
    }
    public boolean set(String key,String value,int timeout,TimeUnit timeUnit){
        return this.set(stringRedisTemplate,key,value,timeout,timeUnit);
    }
    public String get(String key){
       return String.valueOf(stringRedisTemplate.opsForValue().get(key));
    }
}
